#include <bits/stdc++.h>

using namespace std;

int main(int argc, char const *argv[])
{
	int n;scanf("%d",&n);
	std::vector<int> v(n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&v[i]);
	}
	sort(v.begin(),v.end());
	int ans=INT_MAX;
	for (int i = 0; i < n-1; ++i)
	{
		int tmp=abs(v[i]-v[i+1]);
		if(tmp<ans){
			ans=tmp;
		}
	}
	printf("%d\n", ans);
	return 0;
}